package com.youzhi.backend.controller;


import com.youzhi.backend.dto.Result;
import com.youzhi.backend.dto.TreeNode;
import com.youzhi.backend.service.IMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * 系统菜单表 前端控制器
 * </p>
 *
 * @author xumeng
 * @since 2022-12-02
 */
@RestController
@Api(tags = "菜单")
@RequestMapping("/menu")
public class MenuController {


    @Autowired
    private IMenuService service;


    @ApiOperation("/获取权限树")
    @PostMapping("/tree")
    public Result tree() {
        TreeNode treeNode = service.tree();
        return Result.ok(treeNode.getChildren());
    }


}

